/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DAO;

import DTO.ThongTinDonVi_DTO;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

/**
 *
 * @author Phung
 */
public class ThongTinDonVi_DAO {
    
    public static ArrayList<ThongTinDonVi_DTO> GetALL()
    {
        ArrayList<ThongTinDonVi_DTO> ds = new ArrayList<>();
        try {
            String sql = "Select * from ThongTinDonVi" ;
            MySQLDataHelper_DAO.open();
            ResultSet rs =  MySQLDataHelper_DAO.executeQuery(sql);
            while (rs.next()) {
                ThongTinDonVi_DTO ThongTin = new ThongTinDonVi_DTO();
                ThongTin.setID(rs.getInt("ID"));
                ThongTin.setTenDV(rs.getString("TenDV"));
                ThongTin.setDiaChi(rs.getString("DiaChi"));
                ThongTin.setDienThoai(rs.getString("DienThoai"));
                ThongTin.setFax(rs.getString("Fax"));
                ThongTin.setWebSite(rs.getString("WebSite"));
                ThongTin.setEmail(rs.getString("TinNhan"));
                ThongTin.setLinhVuc(rs.getString("LinhVuc"));
                ThongTin.setMaSoThue(rs.getString("MaSoThue"));
                ThongTin.setGPKD(rs.getString("GPKD"));
            }
            MySQLDataHelper_DAO.close();
       }catch (SQLException ex) {
            System.out.println(ex);
        }
        return ds;
    }
}
